﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Net.Mail;
using System.Net.Mime;
using System.Net;

namespace LabFertilizer.Comman
{
    public partial class WSSendmail
    {
        public static void Sendmail(string mailTo, string subject, string content)
        {
            try
            {
                MailMessage MyMailMessage = new MailMessage("labfertilizer@hotmail.com", mailTo, subject, content);
                MyMailMessage.IsBodyHtml = false;
                NetworkCredential mailAuthentication = new NetworkCredential("labfertilizer@hotmail.com", "p@ssw0rdlabfer");
                SmtpClient mailClient = new SmtpClient("smtp.live.com", 587);
                mailClient.EnableSsl = true;
                mailClient.UseDefaultCredentials = false;
                mailClient.Credentials = mailAuthentication;
                mailClient.Send(MyMailMessage);
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }
    }
}